package com.Txunda.fxw.ui.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import com.Txunda.fxw.R;
import com.Txunda.fxw.ui.adapter.base.BaseAdapterForLvOrGv;
import com.Txunda.fxw.ui.adapter.base.BaseViewHolder;
import com.bumptech.glide.Glide;

import java.util.Map;

import butterknife.BindView;

/**
 * =======================================
 * 作   者：Hwangzj
 * 创建时间：2018/11/13 22:31
 * 代码描述：
 * 修改历史：
 * 说   明：
 * =======================================
 */
public class SmallSizedAdapter extends BaseAdapterForLvOrGv<Map<String, String>, SmallSizedAdapter.SmailSizedViewHolder> {
    public SmallSizedAdapter(Context context) {
        super(context);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.item_company_list;
    }

    @Override
    protected SmailSizedViewHolder createViewHolder(View view) {
        return new SmailSizedViewHolder(view);
    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void bindViewData(int position, SmailSizedViewHolder smailSizedViewHolder, Map<String, String> item) {
        smailSizedViewHolder.itemCompanyDistance.setVisibility(View.GONE);
        smailSizedViewHolder.itemCompanyAddress.setVisibility(View.GONE);
        Glide.with(context).load(item.get("cover_pic")).into(smailSizedViewHolder.itemCompanyImg);
        smailSizedViewHolder.itemCompanyTitle.setText(item.get("name"));
        smailSizedViewHolder.itemCompanyDistance.setVisibility(View.GONE);
        smailSizedViewHolder.itemCompanyDistance.setText(item.get("distance"));
        smailSizedViewHolder.itemCompanyAddress.setText(item.get("address") + "/");
        smailSizedViewHolder.itemCompanyAddress.setVisibility(View.GONE);
    }

    class SmailSizedViewHolder extends BaseViewHolder {
        @BindView(R.id.item_company_img)
        ImageView itemCompanyImg;
        @BindView(R.id.item_company_title)
        TextView itemCompanyTitle;
        @BindView(R.id.item_company_address)
        TextView itemCompanyAddress;
        @BindView(R.id.item_company_distance)
        TextView itemCompanyDistance;
        @BindView(R.id.compmay_frame_item)
        FrameLayout compmayFrameItem;

        SmailSizedViewHolder(View itemView) {
            super(itemView);
        }
    }
}
